<%@ page pageEncoding="UTF-8" %>

<nav class="navbar-default navbar-static-side" role="navigation">
    <div class="sidebar-collapse">
        <ul class="nav" id="side-menu">
            <li class="nav-header">
                <div class="dropdown profile-element">
          <span>
              <img alt="image" class="img-circle" src="${BASE}/www/hui/img/profile_small.jpg"/>
          </span>
                    <a data-toggle="dropdown" class="dropdown-toggle" href="index.html#">
              <span class="clear">
                <span class="block m-t-xs">
                  <strong class="font-bold">双扬 - 陈辉</strong>
                </span>
                <span class="text-muted text-xs block">超级管理员
                  <b class="caret"></b>
                </span>
              </span>
                    </a>
                    <ul class="dropdown-menu animated fadeInRight m-t-xs">
                        <li><a href="form_avatar.html">修改头像</a>
                        </li>
                        <li><a href="profile.html">个人资料</a>
                        </li>
                        <li><a href="contacts.html">联系我们</a>
                        </li>
                        <li><a href="mailbox.html">信箱</a>
                        </li>
                        <li class="divider"></li>
                        <li><a href="login.html">安全退出</a>
                        </li>
                    </ul>
                </div>
                <div class="logo-element">
                    H
                </div>

            </li>

            <li nav="index" onclick="clearMenuStorage()">
                <a href="${BASE}/a"><i class="fa fa-windows"></i> <span class="nav-label">管理控制台</span>
                    <%--<span class="label label-danger pull-right">指标分析</span>--%>
                </a>
            </li>

            <li nav="nav_0">
                <a href="#"><i class="fa fa-th-large"></i> <span class="nav-label">原料进销存</span> <span
                        class="fa arrow"></span></a>
                <ul class="nav nav-second-level">
                    <li nav="nav_0_0"><a href="${BASE}/supply">供应商清单</a>
                    </li>
                    <li nav="nav_0_1"><a href="${BASE}/material">饲料原料</a>
                    </li>
                    <%--<li nav="nav_0_2"><a href="index_3.html">主页示例三</a>--%>
                    <%--</li>--%>
                    <%--<li><a href="index_4.html">主页示例四</a>--%>
                    <%--</li>--%>
                </ul>
            </li>

            <li nav="nav_1">
                <a href="#"><i class="fa fa fa-globe"></i> <span class="nav-label">饲料配方</span><span
                        class="fa arrow"></span></a>
                <ul class="nav nav-second-level">
                    <li nav="nav_1_1"><a href="${BASE}/recipe/needs">营养配方</a>
                    </li>
                    <li nav="nav_1_2"><a href="${BASE}/recipe">配方单</a>
                    </li>
                    <li nav="nav_1_3"><a href="${BASE}/order">生产单</a>
                    </li>
                </ul>
            </li>


            <li>
                <a href="index.html#"><i class="fa fa-bar-chart-o"></i> <span class="nav-label">成品进销存</span><span
                        class="fa arrow"></span></a>
                <ul class="nav nav-second-level">
                    <li><a href="graph_echarts.html">test99</a>
                    </li>
                </ul>
            </li>

            <li>
                <a href="index.html#"><i class="fa fa-bar-chart-o"></i> <span class="nav-label">资金管理</span><span
                        class="fa arrow"></span></a>
                <ul class="nav nav-second-level">
                    <li><a href="#">test</a>
                    </li>
                    <%--<li><a href="graph_flot.html">Flot</a>--%>
                    <%--</li>--%>
                    <%--<li><a href="graph_morris.html">Morris.js</a>--%>
                    <%--</li>--%>
                    <%--<li><a href="graph_rickshaw.html">Rickshaw</a>--%>
                    <%--</li>--%>
                    <%--<li><a href="graph_peity.html">Peity</a>--%>
                    <%--</li>--%>
                    <%--<li><a href="graph_sparkline.html">Sparkline</a>--%>
                    <%--</li>--%>
                </ul>
            </li>
        </ul>

    </div>
</nav>


<script>
    $(function(){
        var navigation = $.localStorage('nav');
        //console.log("localstorage navigation: "+ navigation);
        if(navigation && navigation.length > 4){
            // 取一级菜单
            var level_1_index = navigation.lastIndexOf("_");
            var menu_1 = navigation.substring(0,level_1_index);
            $("li[nav="+menu_1+"]").addClass("active");
            // 二级菜单
            $("li[nav="+navigation+"]").addClass("active");
        }else{
            // 字符串null
            $("li[nav=index]").addClass("active");
        }
        $(".nav-second-level").find("li").bind("click",function(){
            $.localStorage('nav', $(this).attr("nav"));
        });
    });

    function clearMenuStorage(){
        $.localStorage('nav', null);
    }
</script>
